# include <bits/stdc++.h>
using namespace std;

int a[202], b[202], n, na, nb, ans[2];

inline int gn() {
	int k = 0, f = 1;
	char c = getchar();
	for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}

inline void judge(int x, int y) {
	bool flag = 0;
	int add = 0;
	if(x > y) swap(x, y), flag = 1;
    if(x == y) return;
    else if(!x && y ^ 2 && y ^ 3) add = 1;
    else if(x == 1 && y ^ 3) add = 1;
    else if(x == 2 && y ^ 4) add = 1;
    if(flag) add = !add;
    ans[add]++;
}

int main() {
    n = gn(), na = gn(), nb = gn();
    for(int i = 1; i <= na; i++) {
        a[i] = gn();
    }
    for(int i = 1; i <= nb; i++) {
        b[i] = gn();
    }
    int l = 1, r = 1;
    for(int i = 1; i <= n; i++, l++, r++) {
        if(l > na) l = 1;
        if(r > nb) r = 1;
        judge(a[l], b[r]);
    }
    printf("%d %d\n", ans[0], ans[1]);
}
